// AUTO GENERATED CODE!
// CODE GENERATOR WILL NOT PRESERVE MANUAL CHANGES TO THIS CODE!
// 

// MIT License (MIT)
// 
// Copyright (c) 2014 K Ercan Turkarslan
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// 


using System;

namespace Mios.Generated.ServiceFiles
{
    // Generated from S_InsteonNetwork1.xml
    
    public class InsteonNetwork1Service : MiosService
    {
        #region Node : String;
        private String _mNode;
        
        public String Node
        {
            get
            {
                return _mNode ?? GetNode();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetNode() : String;
        public String GetNode()
        {
            _mNode = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "Node"));
            
            return _mNode;
        }
        #endregion Action GetNode
        
        #endregion
        
        
        #region Action ResetNetwork()
        public void ResetNetwork()
        {
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "ResetNetwork");
        }
        #endregion Action ResetNetwork
        
        #region Action RemoveNodes()
        public void RemoveNodes()
        {
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "RemoveNodes");
        }
        #endregion Action RemoveNodes
        
        #region Action AddNodes()
        public void AddNodes()
        {
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "AddNodes");
        }
        #endregion Action AddNodes
        
        #region Action StopAddRemoveNodes()
        public void StopAddRemoveNodes()
        {
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "StopAddRemoveNodes");
        }
        #endregion Action StopAddRemoveNodes
        
        #region Action SendData(String node, String data)
        public void SendData(String node, String data)
        {
            if (String.IsNullOrEmpty(node))
                throw new ArgumentNullException("node");
            
            if (String.IsNullOrEmpty(data))
                throw new ArgumentNullException("data");
            
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SendData"
                , String.Format("Node={0}", ToLuup(node))
                , String.Format("Data={0}", ToLuup(data))
                ); // Engine.Luup_CallAction
        }
        #endregion Action SendData
        
        
        #region Method SetVariable(String name, String value) : Boolean;
        internal override Boolean SetVariable(String name, String value)
        {
            switch(name)
            {
                case "Node":
                    _mNode = FromLuupString(value); return true;
                default:
                    return false;
            }
        }
        #endregion Method SetVariable
        
        public InsteonNetwork1Service(MiosEngine engine, UInt32 deviceId, String serviceId)
            : base(engine, deviceId, serviceId)
        {
            
        } //End Constructor
    } //End of class
} //End of Namespace

